From 19209e3a151894c12655bb41a7aa038f83b3d22a Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Sun, 25 Nov 2007 22:59:50 +0000 Subject: [PATCH] Use the monitor the window currently is on, not always the primary 2007-11-26 Tor Lillqvist * gdk/win32/gdkwindow-win32.c (gdk_window_fullscreen): Use the monitor the window currently is on, not always the primary monitor. (#463865, Tim Evans) svn path=/trunk/; revision=19047 --- ChangeLog | 6 ++++++ gdk/win32/gdkwindow-win32.c | 25 ++++++++++++++++++++----- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index b6ac1a7215..fc871de6f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-11-26 Tor Lillqvist + + * gdk/win32/gdkwindow-win32.c (gdk_window_fullscreen): Use the + monitor the window currently is on, not always the primary + monitor. (#463865, Tim Evans) + 2007-11-26 Tor Lillqvist * gdk/win32/gdktestutils-win32.c: New file, dummy implementations. diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c index 51db1c1669..4fd8ce7a86 100644 --- a/gdk/win32/gdkwindow-win32.c +++ b/gdk/win32/gdkwindow-win32.c @@ -3313,9 +3313,11 @@ struct _FullscreenInfo void gdk_window_fullscreen (GdkWindow *window) { - gint width, height; + gint x, y, width, height; FullscreenInfo *fi; GdkWindowObject *private = (GdkWindowObject *) window; + HMONITOR monitor; + MONITORINFO mi; g_return_if_fail (GDK_IS_WINDOW (window)); @@ -3327,9 +3329,22 @@ gdk_window_fullscreen (GdkWindow *window) { GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (private->impl); - width = GetSystemMetrics (SM_CXSCREEN); - height = GetSystemMetrics (SM_CYSCREEN); - + monitor = MonitorFromWindow (GDK_WINDOW_HWND (window), MONITOR_DEFAULTTONEAREST); + mi.cbSize = sizeof (mi); + if (monitor && GetMonitorInfo (monitor, &mi)) + { + x = mi.rcMonitor.left; + y = mi.rcMonitor.top; + width = mi.rcMonitor.right - x; + height = mi.rcMonitor.bottom - y; + } + else + { + x = y = 0; + width = GetSystemMetrics (SM_CXSCREEN); + height = GetSystemMetrics (SM_CYSCREEN); + } + /* remember for restoring */ fi->hint_flags = impl->hint_flags; impl->hint_flags &= ~GDK_HINT_MAX_SIZE; @@ -3340,7 +3355,7 @@ gdk_window_fullscreen (GdkWindow *window) (fi->style & ~WS_OVERLAPPEDWINDOW) | WS_POPUP); API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), HWND_TOP, - 0, 0, width, height, + x, y, width, height, SWP_NOCOPYBITS | SWP_SHOWWINDOW)); gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FULLSCREEN); -- 2.30.2